package com.ims.core.inconfig.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ims.common.annotation.Log;
import com.ims.common.core.controller.BaseController;
import com.ims.common.core.domain.AjaxResult;
import com.ims.common.enums.BusinessType;
import com.ims.core.inconfig.domain.TInConfig;
import com.ims.core.inconfig.service.ITInConfigService;
import com.ims.common.utils.poi.ExcelUtil;
import com.ims.common.core.page.TableDataInfo;

/**
 * 进项系统管理Controller
 *
 * @author IMS
 * @date 2024-05-21
 */
@RestController
@RequestMapping("/inconfig/inconfig")
public class TInConfigController extends BaseController
{
    @Autowired
    private ITInConfigService tInConfigService;

    /**
     * 查询进项系统管理列表
     */
    @PreAuthorize("@ss.hasPermi('inconfig:inconfig:list')")
    @GetMapping("/list")
    public TableDataInfo list(TInConfig tInConfig)
    {
        startPage();
        List<TInConfig> list = tInConfigService.selectTInConfigList(tInConfig);
        return getDataTable(list);
    }

    /**
     * 导出进项系统管理列表
     */
    @PreAuthorize("@ss.hasPermi('inconfig:inconfig:export')")
    @Log(title = "进项系统管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TInConfig tInConfig)
    {
        List<TInConfig> list = tInConfigService.selectTInConfigList(tInConfig);
        ExcelUtil<TInConfig> util = new ExcelUtil<TInConfig>(TInConfig.class);
        util.exportExcel(response, list, "进项系统管理数据");
    }

    /**
     * 获取进项系统管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('inconfig:inconfig:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tInConfigService.selectTInConfigById(id));
    }

    /**
     * 新增进项系统管理
     */
    @PreAuthorize("@ss.hasPermi('inconfig:inconfig:add')")
    @Log(title = "进项系统管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TInConfig tInConfig)
    {
        return toAjax(tInConfigService.insertTInConfig(tInConfig));
    }

    /**
     * 修改进项系统管理
     */
    @PreAuthorize("@ss.hasPermi('inconfig:inconfig:edit')")
    @Log(title = "进项系统管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TInConfig tInConfig)
    {
        return toAjax(tInConfigService.updateTInConfig(tInConfig));
    }

    /**
     * 删除进项系统管理
     */
    @PreAuthorize("@ss.hasPermi('inconfig:inconfig:remove')")
    @Log(title = "进项系统管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tInConfigService.deleteTInConfigByIds(ids));
    }
}
